import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'

import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'
import HomePageVue from '@/views/HomePage.vue'
import ClientCategory from '@/views/userManagement/client/ClientCategory.vue'
import AdminCategory from '@/views/userManagement/admin/AdminCategory.vue'
import DeviceManage from '@/views/device/DeviceManage.vue'
import RepairerManage from '@/views/userManagement/repair/RepairerManage.vue'
import DistrictCategory from '@/views/districtManagement/DistrictCategory.vue'
import WorkOrderCategory from '@/views/WorkOrder/WorkOrderCategory.vue'
import WarningCategory from '@/views/warning/WarningCategory.vue'
import MessageManagement from '@/views/message/MessageManagement.vue'
import ArticleCategory from '@/views/article/ArticleCategory.vue'
import FeedbackCategory from '@/views/feedback/FeedbackCategory.vue'
//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    {
        path: '/', component: LayoutVue,redirect:'/home', children: [
            { path: '/user/info', component: UserInfoVue },
            { path: '/user/avatar', component: UserAvatarVue },
            { path: '/user/resetPassword', component: UserResetPasswordVue },
            { path: '/home', component: HomePageVue },
            { path: '/userManagement/client', component: ClientCategory },
            { path: '/userManagement/admin', component: AdminCategory },
            { path: '/device', component: DeviceManage},
            { path: '/userManagement/repair', component: RepairerManage },
            { path: '/districtManagement', component:  DistrictCategory},
            { path: '/workOrder', component:  WorkOrderCategory},
            { path: '/warning', component:  WarningCategory},
            { path: '/message', component: MessageManagement},
            { path: '/article', component: ArticleCategory},
            { path: '/feedback', component: FeedbackCategory},
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
